package com.example.album;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface CollectionRepository extends JpaRepository<Collection, String> {
    Collection save(Collection collection);
    Collection findByUserIdAndAlbumId(String userId, String albumId);
    void delete(Collection collection);
    @Query("select c.albumId from Collection c where c.userId = :userId")
    List<String> findAlbumIdsByUserId(@Param("userId") String userId);
    long countCollectionsByUserId(String userId);
}

